<template>
  <el-card class="box-card">
    <div slot="header" class="clearfix">
      <shopee-table stripe :data="taskInstanceDetailsData">

        <shopee-table-column prop="name" label="参数名称" :width="200">
        </shopee-table-column>

        <shopee-table-column prop="value" label="参数值" fixed="right" :width="800">
           <template slot-scope="props">
              <div v-if="props.row.type==='list'">
                  <p v-for="item in props.row.value">
                    {{item}}
                  </p>
              </div>

              <div v-if="props.row.type==='git_info_list'">
                  <p v-for="item in props.row.value">
                    {{item["type"]}}-{{item["modulename"]}}-<el-link target="_blank" type="primary" :href='item["git_url"]'>{{item["git_url"]}}</el-link>
                  </p>
              </div>

             <div v-if="props.row.type==='string'">
                {{props.row.value}}
              </div>
              <div v-if="props.row.type==='link'">
                 <el-link target="_blank" :href="props.row.value" type="primary">{{props.row.value}}</el-link>
              </div>

           </template>
        </shopee-table-column>

      </shopee-table>
    </div>
  </el-card>
</template>

  <script>
    import {api, getRequest, postRequest} from "@/api/commit";

    export default {
      name : "TaskInstanceDetailsView",
      data() {
        return {
          taskInstanceDetailsData: [],
        }
      },
      methods: {
        init_data() {
          let params ={
            "id": this.$route.query.id
          }
          getRequest(api['task_instance_display_list'],params).then((res) => {
            res = res.resultReturn
            this.taskInstanceDetailsData= res.data
          }, (error) => {
            console.info(error)
          })
        }
      },
      mounted () {
        this.init_data()
      }
    }
  </script>
